let winResize = []
let winRefresh = []
let winOnload = []

window.onresize = function () {
    winResize.forEach(fun => fun())
}

window.onload = function () {
    winOnload.forEach(fun => fun())
}

window.addEventListener('beforeunload', () => {
    winRefresh.forEach(fun => fun())
}, false)

function addWinResize(fun) {
    winResize.push(fun)
}

function addWinRefresh(fun) {
    winRefresh.push(fun)
}

function addWinOnload(fun) {
    winOnload.push(fun)
}

export default {
    addWinResize,
    addWinRefresh,
    addWinOnload
}